﻿using FixMath.NET;
using GameConfig.item;
using System;
using TEngine;
using UnityEngine;

namespace GameLogic
{
    [Update]
    public class WeaponModule : BehaviourSingleton<WeaponModule>
    {

        public Sprite GetWeaponSprite(int weaponID)
        {
            var weaponCfg = ConfigSystem.Instance.Tables.TbWeapon.GetOrDefault(weaponID);
            if (weaponCfg == null)
                return null;
            try
            {
            return GameModule.Resource.LoadAsset<Sprite>(weaponCfg.SpritePath);
            }catch(Exception e)
            {
                Debug.LogError(e);
                return null;
            }
        }
    }
}
